//
//  NSObject+HDLockManger.m
//  app
//
//  Created by pro on 2017/4/11.
//  Copyright © 2017年 hdaren. All rights reserved.
//

#import "HDLockManger.h"

@interface HDLockManger ()

@property (nonatomic,strong) JKHttpClient * jkHttp;

@end

@implementation  HDLockManger

+(HDLockManger *)shareManager
{
    AS_SINGLETON(HDLockManger, manager,{
        manager = [[HDLockManger alloc]init];
        manager.jkHttp = [[JKHttpClient alloc]init];

        
    })
    return manager;
}


-(void)loginRequst:(HDLockRequset *)request Params:(NSDictionary *)params
{
    if ([self.jkHttp isRunning]) {
        return;
    }

//    NSString * url = @"http://221.204.11.69:3002/api/v1/login";
    NSString * url = @"http://pass.mylife114.com/api/v1/login";
    [self.jkHttp get:url params:params result:^(JKResponse *resp) {
       
        request.msg = resp.message;
        
        if (resp.status == 0) {
            
            request.success = YES;
            request.status = 0;
           // request.msg = resp.message;
            request.pushDic = resp.content;
            
            
        }else
        {
            request.failure = YES;
        }
        [request invoke];
        
    }];
    
    
}


-(void)getMIyaoRequest:(HDMiyaoRequset *)request Params:(NSDictionary *)params
{
    if ([self.jkHttp isRunning]) {
        return;
    }
    
//    NSString * url = @"http://221.204.11.69:3002/api/v1/getkeys";
    NSString * url = @"http://pass.mylife114.com/api/v1/getkeys";
    [self.jkHttp get:url params:params result:^(JKResponse *resp) {
        
        request.msg = resp.message;
        request.status = resp.status;
        if (resp.status == 0) {
            
            request.success = YES;
            request.status = 0;
           // request.msg = resp.message;
            request.pushDic = resp.content;
            
            
        }else
        {
            request.failure = YES;
        }
        [request invoke];
        
    }];

}

-(void)getJiHuoRequest:(HDJiHuoRequset *)request Params:(NSDictionary *)params
{
    if ([self.jkHttp isRunning]) {
        return;
    }
    
//    NSString * url = @"http://221.204.11.69:3002/api/v1/active";
    NSString * url = @"http://pass.mylife114.com/api/v1/active";
    [self.jkHttp get:url params:params result:^(JKResponse *resp) {
        
        request.msg = resp.message;
        
        if (resp.status == 0) {
            
            request.success = YES;
            request.status = 0;
            
            request.pushDic = resp.content;
            
            
        }else
        {
            request.failure = YES;
        }
        [request invoke];
        
    }];
}

-(void)getErWeiMaRequest:(HDErWeiMaRequset *)requset Params:(NSDictionary *)params
{
    if ([self.jkHttp isRunning]) {
        return;
    }
    
//    NSString * url = @"http://221.204.11.69:3002/api/v1/getqrcode";
    NSString * url = @"http://pass.mylife114.com/api/v1/getqrcode";
    [self.jkHttp post:url params:params result:^(JKResponse *resp) {
        
        requset.msg = resp.message;
        
        if (resp.status == 0) {
            
            requset.success = YES;
            requset.status = 0;
            
            requset.pushDic = resp.content;
            
            
        }else
        {
            requset.failure = YES;
        }
        [requset invoke];
        
    }];
}


-(void)getMsgCodeRequest:(HDMsgCodeRequset *)request Params:(NSDictionary *)params
{
    if ([self.jkHttp isRunning]) {
        return;
    }
    
//    NSString * url = @"http://221.204.11.69:3002/api/v1/sms?phone";
    NSString * url = @"http://pass.mylife114.com/api/v1/sms?phone";
    [self.jkHttp get:url params:params result:^(JKResponse *resp) {
        
        request.msg = resp.message;
        if (resp.status == 0) {
            
            request.success = YES;
            request.status = 0;
            //request.msg = resp.message;
            request.pushDic = resp.content;
            
            
        }else
        {
            request.failure = YES;
        }
        [request invoke];
        
    }];

}

@end
